package com.gonsin.i18n.lib.utils;

public class AESUtils {

    /**
     * 加密
     */

    public static String encryptECB(String data, String key, String encoder)  {
        AesInstance instance = null;
        try {
            instance = AesInstance.getInstance(key.getBytes(encoder), key.getBytes(encoder));
            return instance.encText(data);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 解密
     */
    public static String decryptECB(String base64Data, String key, String encoder) {
        AesInstance instance = null;
        try {
            instance = AesInstance.getInstance(key.getBytes(encoder), key.getBytes(encoder));
            return instance.decText(base64Data);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
